home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Program ZipList;
-
-
-
- {*****************************************************************************
-
- Example program for use with ZIPPER.PAS.
-
- NOTE: Most of the Zipper routines were written with pointers in mind,
- assuming that a program would want to process ZIP entryies via
- linked lists (or some other dynamic data structure). In this
- test code, you notice that I used a static data structure (Zrec)
- and passed to other procedures as @Zrec. Sorry for the confusion.
-
-
- Public Domain May 2, 1989, by Tom Guinther
-
- *****************************************************************************}
-
-
-
-
-
- Uses
- Zipper;
-
-
- Const
- CompMethodStr : Array[0..5] of String = ('No Compression','Shrunk','Reduced (CF=1)',
- 'Reduced (CF=2)','Reduced (CF=3)','Reduced (CF=5)');
-
-
-
- Function Pad(S : String; Len : Byte) : String;
- Begin
-
- While Length(S) < Len Do
- S := S + ' ';
-
- Pad := S;
-
- End;
-
-
- Procedure Header;
- Begin
-
- Writeln;
-
- Writeln('File name Normal Compressed Factor Compression Method');
-
- Writeln;
-
- End;
-
-
-
- Procedure ShowFile(pZ : pZipDir);
- Begin
-
-
- With pZ^, pCD^, FileInfo Do
- Begin
-
- Write(Pad(MakeFileName(pZ),12),UnCompSize:10,CompSize:12);
- Write(100-((CompSize/UnCompSize)*100):10:0,'%');
- Writeln(' ',CompMethodStr[CompMethod]);
-
- End;
-
- End;
-
-
-
- Var
- zF : zFile;
- Zrec : ZipDirRec;
-
-
- Begin
-
- If ParamCount <> 1 Then
- Begin
-
- Writeln;
- Writeln('Usage: ZipList <FILENAME.ZIP>');
- Halt;
-
- End;
-
-
- If NOT OpenZip(zF,ParamStr(1)) then
- Begin
-
- Writeln('Unable to open: ',ParamStr(1));
- Exit;
-
- End;
-
- If FindCentralDirectory(zF) <> 0 Then
- Begin
-
- Header;
-
- While ReadCentralDirEntry(zF,@ZRec) Do
- Begin
-
- ShowFile(@Zrec);
- FreeZipRec(@ZRec);
-
- End;
-
- End
- Else
- Writeln(ParamStr(1)+': Unable to find ZIP directory.');
-
- Close(zF);
-
- End.